package vip.meeet.report;

import org.apache.commons.io.IOUtils;

import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.List;

public class GitRuntime {

    /**
     * 执行cmd命令
     * @param cmd
     * @return
     */
    public static List<String> runCmd(String cmd){
        Runtime rt = Runtime.getRuntime();
        List<String> lines = Collections.emptyList();
        try {
            Process process = rt.exec(cmd);
            InputStream inputStream = process.getInputStream();
            lines = IOUtils.readLines(inputStream, Charset.defaultCharset());
        } catch (IOException e) {
            e.printStackTrace();
        }
        return lines;
    }
}
